<?php
namespace Mob\Model;

use Think\Model;
use Think\Hook;
/**操作日志模型
 * Class InfoModel
 */

require_once ('./Application/Mob/Common/function.php');

class OperateLogModel extends Model {

    protected $tableName = 'operatelog';  //好像有点问题，不知道为啥拼表的时候，不太对。所以指定表名吧。

    /**
	 * write  写操作日志
	 * $data  插入数组
	 * @author:wanghongyan
	 */


   public function write($data)
   {
   return $result = $this->add($data);
   }
   /**
	 * write  查询操作日志
	 * $data  插入数组
	 * @author:wanghongyan
	 */
   public function query($where,$count='')
   {
   if($where)   //判断一下where条件，如果为空，直接返回
   {
   if($count)
   {
   return $result = $this->where($where)->limit($count)->select();
   }else
   {
  	return $result = $this->where($where)->field('OperateTime,OperateType,OperateUid,OperateFlg,BusinessSerialno,Ext,OperateContents')->select();
    }
   }else
   {
   return null;
   }


   }

   public function delete($where,$count='')
   {

    if($count)
    {
   $result= $this->where($where)->delete();
    }
    else
    {
    $result= $this->where($where)->delete()->limit($count)->delete();
    }
   return $result;

   }













}